#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
int arr[6][6];
void resve()
{
	for (int i = 1; i <= 5; i++)
	{
		for (int j = 1; j <= 5; j++)
		{
			scanf("%d", &arr[i][j]);
		}
	}
}

void ad()
{

	int max, max_j, min, min_i, count = 0;
	for (int i = 1; i <= 5; i++)
	{
		max = arr[i][1];
		max_j = 1;
		for (int j = 1; j <= 5; j++)
		{
			if (arr[i][j] > max)
			{
				max = arr[i][j];
				max_j = j;
			}
		}
		min = arr[1][max_j];
		min_i = 1;
		for (int j = 1; j <= 5; j++)
		{
			if (arr[j][max_j] < min)
			{
				min = arr[j][max_j];
				min_i = j;
			}
		}
		if (min_i == i)
		{
			count++;
			printf("%d %d %d", i, max_j, max);
		}

	}
	if (count == 0) printf("not found");

}
int main()
{
	resve();
	ad();
	return 0;
}